/**
 * @Author: oldTea
 * @CreateTime: 2024-09-05
 * @Description: kafka消费者
 * @Version: 1.0
 */
package com.ambition.demo.kafka.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.config.KafkaListenerEndpointRegistrar;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 *@Author: oldTea
 *@CreateTime: 2024-09-05
 *@Description: kafka消费者
 *@Version: 1.0
 */
@Component
@Slf4j
public class MyKafkaListener {

    //@KafkaListener(topics = {"clj_test"}, groupId = "consumer1",autoStartup = "true")
    //public void consumer1(String message, Acknowledgment ack) {
    //    int i =1;
    //    log.info("consumer01: {}", message);
    //    ack.acknowledge();
    //}
//
//    @KafkaListener(topics = {"clj_test"}, groupId = "consumer2")
//    public void consumer2(List<String> message) {
//        log.info("consumer02: ,count:{},message:{}", message.size(),message);
//    }
//
//    @KafkaListener(topics = {"clj_test"}, groupId = "consumer3")
//    public void consumer3(List<ConsumerRecord<String,String>> records) {
//        log.info("consumer03:,count:{},message{}:", records.size(),records);
//    }
}

